package com.l2qq.vben.auth;

import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.stp.StpUtil;
import com.l2qq.common.model.Account;

import java.util.Collections;
import java.util.List;

public class StpInterfaceImpl implements StpInterface {

    private PermissionService permissionService;

    public List<String> getPermissionList(Object loginId, String loginType) {
        Account account = (Account) StpUtil.getTokenSession().get("loginAccount");
        if (account == null) return Collections.emptyList();
        return permissionService.getUserPermissions(account.getId());
    }

    public List<String> getRoleList(Object loginId, String loginType) {
        Account account = (Account) StpUtil.getTokenSession().get("loginAccount");
        if (account == null) return Collections.emptyList();
        return permissionService.getUserRoles(account.getId());
    }
}